//
//  GraphicTableCell.m
//  Alltelevisionnews
//
//  Created by dllo on 15/11/28.
//  Copyright © 2015年 蓝鸥科技. All rights reserved.
//

#import "GraphicTableCell.h"

@implementation GraphicTableCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self createView];
    }
    return self;
}

- (void)createView {
    
    self.leftImage = [[UIImageView alloc] init];
    [self.contentView addSubview:self.leftImage];
    self.leftImage.layer.cornerRadius = 120 * self.contentView.frame.size.height / 110;
    self.leftImage.layer.masksToBounds = YES;
    
   ////
    self.titleLabel = [[UILabel alloc] init];
    self.titleLabel.font = [UIFont systemFontOfSize:22];
    [self.contentView addSubview:self.titleLabel];
//
    self.talkLabel = [[UILabel alloc] init];
    [self.contentView addSubview:self.talkLabel];
    
    self.rightButton = [UIButton buttonWithType:UIButtonTypeSystem];
    [self.contentView addSubview:self.rightButton];
    [self.rightButton setBackgroundImage:[UIImage imageNamed:@"goView.png"] forState:UIControlStateNormal];
    
    
 }

- (void)layoutSubviews {
    
    [super layoutSubviews];
    
    [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.contentView.mas_top).with.offset(15);
        make.left.equalTo(self.leftImage.mas_right).with.offset(5);
        make.width.mas_equalTo(150);
        make.height.mas_equalTo(60);
    }];
    
    
    [self.leftImage mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.contentView).with.offset(10);
        make.width.mas_equalTo(100 * self.contentView.frame.size.height / 110);
        make.top.equalTo(self.contentView).with.offset(5);
        make.bottom.equalTo(self.contentView).with.offset(-5);
    }];
////
   
    [self.talkLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.leftImage.mas_right).with.offset(5);
        make.top.equalTo(self.titleLabel.mas_bottom).with.offset(0);
        make.bottom.equalTo(self.contentView).with.offset(-10);
        make.width.mas_equalTo(150);
    }];
    
    [self.rightButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(self.contentView).with.offset(-5);
        make.width.mas_equalTo(40);
        make.top.equalTo(self.contentView).with.offset(40);
        make.bottom.equalTo(self.contentView).with.offset(-40);
    }];
    
    
}



- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
